﻿

<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8"%>  
<%@ include file="/framework/head.jsp"%>

<!--********************* Part2:Java Code *********************-->
<% 
    WarehouseCategoryRelationSearchEvent event = (WarehouseCategoryRelationSearchEvent)context.getSessionValue("WarehouseCategoryRelationEvent");
    ObjectList list = WarehouseCategoryRelation.fetch().search(con,event);
    String warehouseCategoryId = context.getString("warehouseCategoryId");
%>


<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->
<%@page import="system.base.WarehouseCategoryRelation"%>
<script language=javascript>

var list_code = "toProductManage";

function doSearch()
{
    SetValue("s_CategoryCode",GetValue("i_CategoryCode")); //分类编码
    SetValue("s_ProductCode",GetValue("i_ProductCode")); //集中编码
    SetValue("s_ProductName",GetValue("i_ProductName")); //产品名称
    SetValue("s_Spec",GetValue("i_Spec")); //规格
    SetValue("s_WarehouseCode",GetValue("i_WarehouseCode")); //仓库名称
    SetValue("s_IsNormal",GetValue("i_IsNormal")); //是否正式产品
    SetValue("s_IsTradeflatProduct",GetValue("i_IsTradeflatProduct")); //数据类型
    SetValue("s_Status",GetValue("i_Status")); //是否有效
    SetValue("s_IsBuy",GetValue("i_IsBuy")); //是否可采购
    SetValue("s_OrderField",GetValue("i_OrderField")); //排序
    SetValue("s_OrderDesc",getCheckBoxValues("i_OrderDesc")); //升降序
    doCommonSearch();
}

function bizViewProduct(id)
{
    viewWin("<%=Config.getSrv()%>?action_code=viewProduct&RelationId="+id);
}

function doDelete()
{
    if(!hasChooseRadio("ids"))
    {
        bizMessage("删除","产品");
        return false;
    }
    if(!bizConfirm("删除","产品分类关系")) return false;
    SetAction("deleteWarehouseCategoryRelation");
    frm.submit();
}

function doToAdd()
{  
    SetValue("categoryCode","<%=event.getCategoryCode()%>");
    SetValue("warehouseCode","<%=event.getWarehouseCode()%>");
    SetValue("isWarehouseCategoryProduct","1");
    <%String str = String.valueOf(context.getSessionValue("warehouseCategoryId"));%>
    SetValue("warehouseCategoryId","<%=str%>");
    SetAction("addProduct");
    frm.submit();
}
function doExcel(){
    <%if(list.getTotalSize()>20000){%>
        alert("导出EXCEL产品数量不能超过20000条！");
        return false;
    <%}else{%>
        window.location.href="<%=Config.getWebPath()%>/GSproductDown?type=1";
    <%}%>
}
key_InitDefault();
key_RegSubmitHandler(doSearch);
</script>
<%=uiBody%>>

<%@ include file="/framework/menu.jsp"%>

<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<input type=hidden name="Id" value="">
<input type=hidden name=sortOrder value="1">
<input type=hidden name="categoryCode" value="">
<input type=hidden name="warehouseCode" value="">
<input type=hidden name="warehouseCategoryId" value="<%=warehouseCategoryId%>">

<!--查询条件保留区域-->
<input type=hidden name="s_CategoryCode" value="<%=event.getCategoryCode()%>"> <!--分类编码-->
<input type=hidden name="s_ProductCode" value="<%=event.getProductCode()%>"> <!--产品编码-->
<input type=hidden name="s_ProductName" value="<%=event.getProductName()%>"> <!--产品名称-->
<input type=hidden name="s_Spec" value="<%=event.getSpec()%>"> <!--规格-->
<input type=hidden name="s_WarehouseCode" value="<%=event.getWarehouseCode()%>"> <!--仓库名称-->
<input type=hidden name="s_IsNormal" value="<%=event.getIsNormal()%>"> <!--是否正式产品-->
<input type=hidden name="s_IsTradeflatProduct" value="<%=event.getIsTradeflatProduct()%>"> <!--数据类型-->
<input type=hidden name="s_Status" value="<%=event.getStatus()%>"> <!--是否有效-->
<input type=hidden name="s_IsBuy" value="<%=event.getIsBuy()%>"> <!--是否可采购-->
<input type=hidden name="isWarehouseCategoryProduct" value="1">
<%@ include file="/framework/list_head.jsp"%>

<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
    int key_tab = 1 ;
%>
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
         产品分类：<% 
         System.out.println("warehousecode = "+event.getWarehouseCode());
         System.out.println("categorycode = "+event.getCategoryCode());
         %>
        <%=WarehouseCategory.fetchbyCode(con,event.getCategoryCode(),event.getWarehouseCode()).getCategoryName()%>
        <input type="hidden" class="texts" name="i_CategoryCode" size="20" value="<%=event.getCategoryCode()%>" key_tab="<%=key_tab++%>" disabled>
        </td>       
    </tr>
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
         产品编码：
        <input type="text" class="texts" name="i_ProductCode" size="20" value="<%=event.getProductCode()%>" key_tab="<%=key_tab++%>">
         产品名称：&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="text" class="texts" name="i_ProductName" size="20" value="<%=event.getProductName()%>" key_tab="<%=key_tab++%>">
         规&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格：
        <input type="text" class="texts" name="i_Spec" size="20" value="<%=event.getSpec()%>" key_tab="<%=key_tab++%>">
        </td>        
    </tr>   
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
         所属仓库：&nbsp;<%=Warehouse.getNameByCode(con,event.getWarehouseCode())%><input type=hidden name="i_WarehouseCode" value="<%=event.getWarehouseCode()%>">        
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         是否正式产品：
        <%=SelectManager.viewYesOrNoSelect("i_IsNormal",event.getIsNormal(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td>    
    </tr>
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
         数据类型：
        <%=SelectManager.viewYesOrNoSelectDEALorHAND("i_IsTradeflatProduct",event.getIsTradeflatProduct(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
         有效性：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <%=SelectManager.viewYesOrNoSelect("i_Status",event.getStatus(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
         是否可采购：
        <%=SelectManager.viewYesOrNoSelect("i_IsBuy",event.getIsBuy(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td> 
    </tr>

    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            按&nbsp;排&nbsp;序：
       
            <select name="i_OrderField">
                <option value="" <%=(event.getOrderField().equals("1"))?"selected":""%>>设置排序字段</option>
                <option value="PRODUCT_CODE" <%=(event.getOrderField().equals("PRODUCT_CODE"))?"selected":""%>>产品编码</option>
            </select>
            &nbsp;
            <input type="radio" name="i_OrderDesc" value="false" <%=(event.isOrderDesc()==false)?"checked":""%> >升序
            <input type="radio" name="i_OrderDesc" value="true"  <%=(event.isOrderDesc()==true)?"checked":""%>  >降序
            <input type="button" value="查询" class="buttons" onclick="doSearch();return false;"><input type="button" value="清空" class="buttons" onclick="doClearEvent();return false;">
          
        </td>
    </tr>

<%=uiSearchEnd%>

<!--列表标题-->
<%=UIManager.addListHeadTitle("产品列表")%>

<!--********************* Part6:List Area ***************-->

<%=uiListStart%>>

<%@ include file="/framework/list_foot.jsp"%>

<%
    int index = 1 ;
%>  
    <%=uiListHeadTR%>>
        <%=UIManager.addListHeadCheckBox() %>
        <%=UIManager.addListHead("产品编码",index++)%>
        <%=UIManager.addListHead("产品名称",index++)%>
        <%=UIManager.addListHead("供应商",index++)%>
        <%=UIManager.addListHead("单价",index++,"num")%>
        <%=UIManager.addListHead("计量单位",index++)%>
        <%=UIManager.addListHead("质保期",index++)%>
        <%=UIManager.addListHead("规格",index++)%>
        <%=UIManager.addListHead("型号",index++)%>
        <%=UIManager.addListHead("品牌",index++)%>
        <%=UIManager.addListHead("生产厂商",index++)%>
        <%=UIManager.addListHead("数据类型",index++)%>
        <%=UIManager.addListHead("有效性",index++)%>
        <%=UIManager.addListHead("所属仓库",index++)%>
        <%=UIManager.addListHead("是否正式产品",index++)%>
        <%=UIManager.addListHead("操作",-1)%>  
    <%=uiListHeadTREnd%>>
    
    <!--data-->
<%
    for(int i=0;i<list.size();i++)
    {
        WarehouseCategoryRelation obj = (WarehouseCategoryRelation)list.get(i);
        Product pro = Product.fetchByConcentricityCode(con,obj.getProductCode());
        
        if (pro == null) pro = new Product();
%>
    <%=uiListDataTR[i%2]%> align=center>
        <%=uiListDataTD%>>
            <input type="checkbox" name="ids" value="<%=obj.getId()%>">
            
        </td>
       
        <%=uiListDataTD%>><%=pro.viewConcentricityCode(con)%></td>
        <%=uiListDataTD%>><%=pro.viewName(con)%></td>
        <%=uiListDataTD%>><%=pro.viewProviderCode(con)%></td>
        <%=uiListDataTD%>><%=pro.viewUnitPrice(con)%></td>
        <%=uiListDataTD%>><%=pro.viewProductUnit(con)%></td>
        <%=uiListDataTD%>><%=pro.viewQualityAssurePeriod(con)%></td>
        <%=uiListDataTD%>><%=pro.viewSpec(con)%></td>
        <%=uiListDataTD%>><%=pro.viewModel(con)%></td>
        <%=uiListDataTD%>><%=pro.viewProductBrand(con)%></td>
        <%=uiListDataTD%>><%=pro.viewManufaturer(con)%></td>
        <%=uiListDataTD%>><%=pro.viewIsTradeflatProduct(con)%></td>
        <%=uiListDataTD%>><%=pro.viewStatus(con)%></td>
        <%=uiListDataTD%>><%=obj.viewWarehouseName(con)%></td>
        <%=uiListDataTD%>><%=pro.viewIsNormal(con)%></td>
        <%=uiListDataTD%>>
            <a href="" onclick="bizViewProduct('<%=obj.getId()%>');return false;">浏览</a>
        </td>
       
    </tr>
<%  
    }
%>  

<%@ include file="/framework/list_foot2.jsp"%>
<%=uiListEnd%>
<!--********************* Part7:Action Area ***************-->
<%=uiCommandStart%>>
    <%=uiCommandTR%>>
        <%=uiCommandTD%>>
         <input type=button value="   添加产品   " class="buttons" onclick="doToAdd();return false;">
         <input type=button value="   移出产品   " class="buttons" onclick="doDelete();return false;">
         <input type=button value=" 导出EXCEL " class="buttons" onclick="doExcel();return false;">
        </td>
    </tr>   
<%=uiCommandEnd%>
</form>
<%@ include file="/framework/foot.jsp"%>
<!--
    Author    :chengbiao.he
    FileName  :/system/base/ProductList.jsp
-->
